package com.powerManager.sdk.common;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;

public class JdbcSingleton {

	private static JdbcTemplate jdbcTemplage = null;
	
	public static JdbcTemplate getJdbcTemplate(){
		if(jdbcTemplage == null){
			Resource resource=new ClassPathResource("beans.xml");
	        @SuppressWarnings("deprecation")
			XmlBeanFactory factory = new XmlBeanFactory(resource);        
	        jdbcTemplage = (JdbcTemplate) factory.getBean("jdbcTemplate"); 
		}
		return jdbcTemplage;
	}
}
